<template>
  <div class="table-panel">
    <Indicator v-if="stateList.length > 0" :defaultData="stateList"></Indicator>
    <Condition
      ref="condition"
      :state="paramsTable.state"
      :showCloseBtn="showCloseBtn"
      :isSubMine="isSubMine"
      :showDeleteBtn="showDeleteBtn"
      :showRestoreBtn="showRestoreBtn"
      :showUrgingBtn="showUrgingBtn"
      :showCompleteBtn="showCompleteBtn"
      :showCopyBtn="showCopyBtn"
    ></Condition>

    <Gantt
      ref="gantt"
      v-if="ganttShow"
      width="50%"
      :defaultScroll="ganttDefaultScroll"
      :dataLength="tableData.length - 1"
      affiliationBox="table-class"
      :height="tableHeight"
      :ganttCanOpa="ganttCanOpa"
      :defaultData="tableData"
    />
    <TreeTable
      v-else
      ref="table"
      :defaultData="tableData"
      :showStopCycleTask="showStopCycleTask"
      :showStopCycleTaskBtn="showStopCycleTaskBtn"
      :tableHeight="tableHeight"
    ></TreeTable>
    <div class="table-pagination">
      <el-pagination
        style="float:right"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="paramsTable.pageNo"
        :page-sizes="[30, 50, 100, 200]"
        :page-size="paramsTable.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </div>
    <!-- 新建编辑 fullscreen-->
    <!-- <el-dialog :title="dialogTitle" v-if="dialogVisible" :visible.sync="dialogVisible" width="1400px" :modal-append-to-body="false" @close="handleCloseDialog">
            <iframe :src="dialogUrl" frameborder="0" style="width: 100%; height: 800px" :style="{ height: dialogHeight }"></iframe>
        </el-dialog> -->
  </div>
</template>

<script>
import Indicator from "./components/indicator.vue";
import Condition from "./components/condition.vue";
import TreeTable from "./components/table.vue";
import Gantt from "./components/gantt.vue";

import Bus from "./bus.js";
import ApiTask from "./api";
import axios from 'axios';

export default {
  name: "listTable",
  components: {
    Indicator,
    Condition,
    TreeTable,
    Gantt,
  },
  props: {
    params: {
      type: [Object],
      default: () => {
        return {
          category: "1",
          subCategory: "11",
        };
      },
    },
  },
  data() {
    return {
      showCycle: true,
      showComplete: false,
      isSubMine: this.params.category == "1",
      showCloseBtn: this.params.subCategory != "15" && this.params.subCategory != "16",
      showRestoreBtn: this.params.subCategory == "16",
      showDeleteBtn: this.params.subCategory == "15" || this.params.subCategory == "16",
      showUrgingBtn: this.params.subCategory != "15" && this.params.subCategory != "16",
      showStopCycleTask: this.params.category == "1" && this.params.subCategory != "15",
      showStopCycleTaskBtn: this.params.subCategory != "16",
      showCompleteBtn: this.params.subCategory != "15" && this.params.subCategory != "16",
      showCopyBtn:
        this.params.category == "1" && this.params.subCategory != "15" && this.params.subCategory != "16",
      tableHeight:
        this.params.subCategory != "-1" ? document.documentElement.clientHeight - 296 : document.documentElement.clientHeight - 246,
      dialogHeight: document.documentElement.clientHeight - 180 + "px",
      dialogVisible: false,
      dialogTitle: "新建任务",
      dialogSrc: {
        href: "/seeyon/bhtTask.do?taskId=",
        taskId: "-1",
        param: "&type=",
        type: "create",
        param1: "&superId=",
        superId: "",
      },
      ganttDefaultScroll: {
        x: 0,
        y: 0,
      },
      ganttShow: false, //(localStorage.ganttShow === 'true'),
      ganttCanOpa:
        this.params.category == "1" && (this.params.subCategory == "12" || this.params.subCategory == "11"),
      tableData: [],
      deepTableData: [],
      stateList: [],
      total: 0,
      paramsTable: {
        pageNo: 1,
        pageSize: 30,
        category: 0,
        subCategory: 0,
        state: 0,
      },
      searchParam: {
        title: undefined,
        taskLevel: undefined,
        taskType: undefined,
        publisher: undefined,
        manager: undefined,
        managerDepartment: undefined,
        startDate: undefined,
        endTime: undefined,
        taskState: undefined,
        approveState: undefined,
        importantLevel: undefined,
        taskNum: undefined
      },
    };
  },
  created() {
    let that = this;
    this.paramsTable.category = this.params.category;
    this.paramsTable.subCategory = this.params.subCategory;

    //localStorage.setItem('category', JSON.stringify(this.params));
    //初始化查询
    this.init();
    window["reloadList"] = () => {
      this.listStateByTabs();
      that.listTableByState();
      this.$refs["table"] && this.$refs["table"].clearSelection();
    };
  },
  computed: {
    dialogUrl: function() {
      //所有计算属性都以函数的形式写在Vue实例内的computed选项内，最终返回计算后的结果
      let trueUrl =
        this.dialogSrc.href + this.dialogSrc.taskId + this.dialogSrc.param + this.dialogSrc.type;
      if (this.dialogSrc.superId) {
        trueUrl += this.dialogSrc.param1 + this.dialogSrc.superId;
      }
      return trueUrl;
    },
  },
  mounted() {
    let that = this;
    that.tableHeight =
      that.params.subCategory != "-1"
        ? document.documentElement.clientHeight - 296
        : document.documentElement.clientHeight - 246;

    that.showCycle = this.paramsTable.category == "1";

    Bus.$off("setShowCycle").$on("setShowCycle", (val) => {
      that.showCycle = val;
      that.listTableByState();
    });

    Bus.$off("setShowComplete").$on("setShowComplete", (val) => {
      that.showComplete = val;
      //if(that.paramsTable.state == 0) {
      that.listTableByState();
      //}
    });
    //点击任务分类
    Bus.$off("setStateCondition").$on("setStateCondition", (state) => {
      that.paramsTable.pageNo = 1;
      that.paramsTable.state = state;
      that.showComplete = false;
      // that.showCycle = (state === 5 || state === 4);
      //   that.showCycle = true;
      that.listTableByState();
    });
    //切换甘特图与列表视图
    Bus.$off("changeViews").$on("changeViews", (boo) => {
      this.ganttShow = !!boo;
      //localStorage.ganttShow = boo;
    });
    //查询任务列表
    Bus.$off("getTableList").$on("getTableList", (obj) => {
      this.listTableByState(obj);
    });
    Bus.$off("reloadTableList").$on("reloadTableList", () => {
      this.paramsTable.pageNo = 1;

      this.listTableByState();
    });
    Bus.$off("searchTableByState").$on("searchTableByState", (search) => {
      this.searchParam = search;
      this.listTableByState();
    });
    Bus.$off("setSearchParam").$on("setSearchParam", (search) => {
      for (const key in that.searchParam) {
        if (search.hasOwnProperty(key)) {
          that.$set(that.searchParam, key, search[key]);
        }
      }
    });
    Bus.$off("setTableList").$on("setTableList", (arr) => {
      this.tableData = arr;
    });
    //复制任务
    Bus.$off("copyTask").$on("copyTask", () => {
      this.copyTask();
    });
    //新建任务
    Bus.$off("addTableList").$on("addTableList", (id,taskData) => {
      this.addTableList(id,taskData);
    });
    //关闭任务
    Bus.$off("delTask").$on("delTask", () => {
      this.delTask();
    });
    //删除
    Bus.$off("trueDelTask").$on("trueDelTask", () => {
      this.trueDelTask();
    });
    //恢复任务
    Bus.$off("recoveryTask").$on("recoveryTask", () => {
      this.recoveryTask();
    });
    //催办
    Bus.$off("urgingTask").$on("urgingTask", () => {
      this.urgingTask();
    });
    //查看任务
    Bus.$off("viewTableList").$on("viewTableList", (obj) => {
      this.viewTableList(obj);
    });
    //升级
    Bus.$off("changeUpGrade").$on("changeUpGrade", (id) => {
      this.changeGrade("up", id);
    });
    //降级
    Bus.$off("changeDeGrade").$on("changeDeGrade", (id) => {
      this.changeGrade("de", id);
    });
    //启动周期任务
    Bus.$off("startCycleTask").$on("startCycleTask", (id) => {
      this.changeCycleTask("start", id);
    });
    //停止周期任务
    Bus.$off("stopCycleTask").$on("stopCycleTask", (id) => {
      this.changeCycleTask("stop", id);
    });
    //停止并关闭周期任务
    Bus.$off("stopAndCloseCycleTask").$on("stopAndCloseCycleTask", (id) => {
      this.changeCycleTask("stopAndClose", id);
    });
    //恢复周期任务
    Bus.$off("restoreCycleTask").$on("restoreCycleTask", (id) => {
      this.changeCycleTask("restore", id);
    });
    //恢复并启动周期任务
    Bus.$off("restoreAndStartCycleTask").$on("restoreAndStartCycleTask", (id) => {
      this.changeCycleTask("restoreAndStart", id);
    });

    //甘特图修改任务进度
    Bus.$off("handlerTaskUpdate").$on("handlerTaskUpdate", (obj) => {
      that.handlerTaskUpdate(obj);
    });
    //设置前置任务
    Bus.$off("modifyFrontTask").$on("modifyFrontTask", (obj) => {
      that.modifyFrontTask(obj);
    });
    //甘特图视图切换
    Bus.$off("ganttChangeView").$on("ganttChangeView", (obj) => {
      this.$refs["gantt"].ganttChangeView(obj);
    });

    Bus.$off("expandAll").$on("expandAll", (obj) => {
      const $view = this.ganttShow ? this.$refs["gantt"] : this.$refs["table"];
      $view.expandAll();
    });

    Bus.$off("collapseAll").$on("collapseAll", (obj) => {
      const $view = this.ganttShow ? this.$refs["gantt"] : this.$refs["table"];
      $view.collapseAll();
    });

    //任务table拖动
    /* Bus.$off('tableDrag').$on('tableDrag', obj => {
            setTimeout(() => {
                this.tableDrag(obj);
            }, 200);
        });*/

    that.listTableByState();
  },
  methods: {
    openWindow() {
      let type = top.location.href.split("type=")[1];
      let url = `${this.dialogUrl}&isType=${type}`;
      let name = `${this.dialogSrc.type}Window${url}`;
      window.open(
        url,
        name.replace(/[^\w]+/gi, ""),
        "width=" +
          (window.screen.availWidth - 10) +
          ",height=" +
          (window.screen.availHeight - 70) +
          ",top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=yes,location=no, status=no"
      );
    },
    handleSizeChange(size) {
      this.paramsTable.pageSize = size;
      this.listTableByState();
    },
    handleCurrentChange(page) {
      this.paramsTable.pageNo = page || 1;
      this.listTableByState();
    },
    handleCloseDialog() {
      // this.listStateByTabs();
      this.listTableByState();
    },
    init() {
      this.listStateByTabs();
    },
    handleClick(tab, event) {},
    handlerTaskUpdate(obj) {
      ApiTask.updateProgress(obj)
        .then((res) => {
          if (res.data.code === 0) {
            this.$message.success("任务进度修改成功");
          } else {
            this.$message.error(res.data.message);
            this.$refs["gantt"].setTaskProcess(id);
          }
        })
        .catch((res) => {
          this.$message.error("任务进度修改失败");
          this.$refs["gantt"].setTaskProcess(id);
        });
    },
    tableDrag(obj) {
      let param = {
        currentTaskId: "",
        newParentTaskId: "",
      };

      try {
        //正在拖动的任务
        const draggingTask = this.deepTableData[obj.oldIndex];

        param.currentTaskId = draggingTask.taskId;
        param.newParentTaskId = this.$refs["table"].getSelectionTaskId();

        if (!param.newParentTaskId || param.currentTaskId == param.newParentTaskId) {
          //this.$message.error('');
          return false;
        }

        const taskIndex = this.deepTableData.findIndex((item) => {
          return item.taskId === param.newParentTaskId;
        });

        const msg =
          "是否将任务【" +
          draggingTask.title +
          "】及其子任务设置为任务【" +
          this.deepTableData[taskIndex].title +
          "】的子任务";
        this.$confirm(msg, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }).then(() => {
          this.$refs["table"].setLoading(true);
          ApiTask.dragTable(param)
            .then((res) => {
              if (res.data.code === 0) {
                this.listTableByState();
                this.$message.success("任务移动成功");
              } else {
                this.$message.error(res.data.message);
                this.$refs["table"].setLoading(false);
              }
            })
            .catch((res) => {
              this.$message.error("拖动失败");
            });
        });
      } catch (error) {
        console.error(error);
      }
    },
    changeGrade(type, id) {
      let methods = type === "up" ? "upgrade" : "degrade";
      const param = {
        taskId: id,
      };
      ApiTask[methods](param).then((res) => {
        if (res.data.code !== 0) {
          this.$message.error(res.data.message);
        } else {
          this.$message.success((type === "up" ? "升级" : "降级") + "成功");
          this.listTableByState();
        }
      });
    },
    changeCycleTask(type, id) {
      let methods;
      let oprea;
      if (type === "start") {
        methods = "startCycleTask";
        oprea = "启动";
      } else if (type === "stop") {
        methods = "stopCycleTask";
        oprea = "停止";
      } else if (type === "stopAndClose") {
        methods = "stopAndCloseCycleTask";
        oprea = "停止并删除";
      } else if (type === "restore") {
        methods = "restoreCycleTask";
        oprea = "恢复";
      } else if (type === "restoreAndStart") {
        methods = "restoreAndStartCycleTask";
        oprea = "恢复并启动";
      }
      this.$confirm("是否" + oprea + "该周期任务", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        const param = {
          taskId: id,
        };
        ApiTask[methods](param).then((res) => {
          if (res.data.code !== 0) {
            this.$message.error(res.data.message);
          } else {
            this.$message.success(res.data.data);
            this.listStateByTabs();
            this.listTableByState();
          }
        });
      });
    },
    modifyFrontTask(obj) {
      const param = {
        basicInfo: {
          taskId: obj.target,
        },
        extInfo: {
          frontTaskId: obj.source,
        },
      };
      const frontIndex = this.deepTableData.findIndex((item) => {
        return item.taskId === obj.source;
      });
      const taskIndex = this.deepTableData.findIndex((item) => {
        return item.taskId === obj.target;
      });
      if (obj.source) {
        const msg =
          "是否将任务【" +
          this.deepTableData[frontIndex].title +
          "】设置为任务【" +
          this.deepTableData[taskIndex].title +
          "】的前置任务";
        this.$confirm(msg, "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            ApiTask.modifyFrontTask(param)
              .then((res) => {
                if (res.data.code !== 0) {
                  this.$message.error(res.data.message);
                  //失败时删除link
                  this.$refs["gantt"].delTaskLinkId(obj.id);
                } else {
                  this.$message.success("设置前置任务成功");
                }
              })
              .catch(() => {
                //失败时删除link
                this.$refs["gantt"].delTaskLinkId(obj.id);
              });
          })
          .catch(() => {
            //失败时删除link
            this.$refs["gantt"].delTaskLinkId(obj.id);
          });
      } else {
        ApiTask.modifyFrontTask(param).then((res) => {
          if (res.data.code !== 0) {
            this.$message.error(res.data.message);
            //失败时添加link
            //this.$refs['gantt'].delTaskLinkId(obj.id);
          } else {
            //this.$message.success('删除前置任务成功');
          }
        });
      }
    },
    delTask(id) {
      const $view = this.ganttShow ? this.$refs["gantt"] : this.$refs["table"];
      const param = {
        taskId: $view.getSelectionTaskId() || "",
      };
      if (param.taskId.length < 1) {
        this.$message.error("请至少选中一条任务");
        return false;
      }
      this.$confirm("是否删除选中的" + param.taskId.length + "条任务及其所有子任务", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        ApiTask.delTask(param).then((res) => {
          const data = res.data;
          if (data.code !== 0) {
            this.$message.error(data.message || "");
          } else {
            this.$message.success("任务已移动至回收站!");
            this.listStateByTabs();
            this.listTableByState();
          }
        });
      });
    },
    trueDelTask(id) {
      const $view = this.ganttShow ? this.$refs["gantt"] : this.$refs["table"];
      const param = {
        taskId: $view.getSelectionTaskId() || "",
      };
      if (param.taskId.length < 1) {
        this.$message.error("请至少选中一条任务");
        return false;
      }

      this.$confirm("是否永久删除选中的" + param.taskId.length + "条任务及其所有子任务？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        ApiTask.trueDelTask(param).then((res) => {
          const data = res.data;
          if (data.code !== 0) {
            this.$message.error(data.message || "");
          } else {
            this.$message.success("任务已永久删除!");
            this.listStateByTabs();
            this.listTableByState();
          }
        });
      });
    },
    //恢复任务
    recoveryTask(id) {
      const $view = this.ganttShow ? this.$refs["gantt"] : this.$refs["table"];
      const param = {
        taskId: $view.getSelectionTaskId() || "",
      };
      if (param.taskId.length < 1) {
        this.$message.error("请至少选中一条任务");
        return false;
      }
      this.$confirm("是否恢复选中的" + param.taskId.length + "条任务及其所有子任务？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        ApiTask.recoveryTask(param).then((res) => {
          const data = res.data;
          if (data.code !== 0) {
            this.$message.error(data.message || "");
          } else {
            this.$message.success("任务恢复成功");
            this.listStateByTabs();
            this.listTableByState();
          }
        });
      });
    },
    //复制任务
    copyTask(id) {
      const $view = this.ganttShow ? this.$refs["gantt"] : this.$refs["table"];
      const param = {
        taskId: $view.getSelectionTaskId() || "",
      };
      if (param.taskId.length < 1) {
        this.$message.error("请选则一条任务");
        return false;
      } else if (param.taskId.length > 1) {
        this.$message.error("目前只支持单条任务复制");
        return false;
      }
      this.$confirm("是否复制选中的任务", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        ApiTask.copyTask(param).then((res) => {
          const data = res.data;
          if (data.code !== 0) {
            this.$message.error(data.message || "");
          } else {
            this.$message.success("任务复制成功");
            this.listStateByTabs();
            this.listTableByState();
          }
        });
      });
    },
    //催办任务
    urgingTask(id) {
      const $view = this.ganttShow ? this.$refs["gantt"] : this.$refs["table"];
      const param = {
        taskId: $view.getSelectionTaskId() || "",
      };
      if (param.taskId.length < 1) {
        this.$message.error("请至少选中一条任务");
        return false;
      }
      this.$confirm("是否催办选中" + param.taskId.length + "条任务", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        ApiTask.urgingTask(param).then((res) => {
          const data = res.data;
          if (data.code !== 0) {
            this.$message.error(data.message || "");
          } else {
            this.$message.success("任务催办成功");
            //this.listTableByState();
          }
        });
      });
    },
    addTableList(id,taskData) {
      const $view = this.ganttShow ? this.$refs["gantt"] : this.$refs["table"];
      this.dialogTitle = "新建任务";
      this.dialogSrc.type = "create";
      this.dialogSrc.taskId = id ? id : $view.getSelectionTaskId() || "-1";
      this.dialogSrc.superId = "";
      console.log('this.dialogSrc.taskId',this.dialogSrc.taskId)
     
      if(!!this.dialogSrc.taskId && Array.isArray(this.dialogSrc.taskId)){
        axios.get(`/seeyon/rest/taskDetail/${this.dialogSrc.taskId[0]}?option.n_a_s=1`).then((res)=>{
            console.log('res',res)
          if(res.data.code==0){
              let defaultData={}
              defaultData.startDate = res.data.data.basicInfo.startDate
              defaultData.endTime = res.data.data.basicInfo.endTime
              defaultData.richContent =res.data.data.basicInfo.richContent
              defaultData.title =res.data.data.basicInfo.title
              defaultData.reportCycle = res.data.data.extInfo.reportCycle
              defaultData.warnDay = res.data.data.basicInfo.warnDay
              top.window.localStorage.setItem("taskData",JSON.stringify(defaultData));
              this.openWindow();
          }
        })
      }
       else if(taskData){
        top.window.localStorage.setItem("taskData",JSON.stringify(taskData));
        this.openWindow();
      }   
      else{
        this.openWindow();
      }
      //this.dialogVisible = true;
    },
    viewTableList(obj) {
      this.dialogTitle = "查看任务";
      this.dialogSrc.type = "view";
      this.dialogSrc.taskId = obj.taskId;
      this.dialogSrc.superId = obj.superId;
      //this.dialogVisible = true;
      this.openWindow();
    },
    
    getQueryString(name) {
      var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
      var r = top.location.search.substr(1).match(reg);
      if(r!=null) {
        return  unescape(r[2]);
      } 
      return null;
    },
    listStateByTabs() {
      var type = this.getQueryString("type");
      if(type == 1) {
        this.params.maintenance = true
      } 
      ApiTask.listStateByTabs(this.params).then((res) => {
        let data = res.data;
        if (data.code === 0) {
          this.stateList = data.data.map((item) => {
            item["actived"] = false;
            if (item.key === 0) {
              item["actived"] = true;
            }
            return item;
          });
        }
      });
    },
    listTableByState(obj) {
      //进入loading状态
      !obj && !this.ganttShow && this.$refs["table"] && this.$refs["table"].setLoading(true);
      //构造查询方法级参数
      let methods = obj && obj.isLoad ? "listChildTableByState" : "listTableByState",
          params = obj && obj.isLoad ? { state: this.paramsTable.state, taskId: obj.taskId.split(".")[0] } : JSON.parse(JSON.stringify(this.paramsTable));
      params["subCategory"] = this.paramsTable.subCategory;
      params["folder"] = obj && obj.folder;
      params["showCycle"] = this.showCycle;
      if (this.paramsTable.state == 0 || (obj && obj.isLoad)) {
        params["showComplete"] = this.showComplete;
      }
      let params2;
      var type = this.getQueryString("type");
      if (methods == "listChildTableByState") {
        params2 = obj.childrens;
      } else {
        // var type = this.getQueryString("type");
        console.log('type',type)
        if(type == 1) {
          params["maintenance"] = true;
        } 
        params2 = this.searchParam;
      }

      ApiTask[methods](params, params2).then((res) => {
        console.log('ApiTaskres',res)
        let data = res.data;
        if (data.code === 0) {
          let list = [];
          const listData = obj && obj.isLoad ? data.data : data.data.data;
          for (const item of listData) {
            let json = item.basicInfo;
            if (!json["taskId"]) {
              json["taskId"] = json["sourceTaskId"] + ".1";
              json["folder"] = true;
            }
            json["processRate"] = (item.basicInfo.processRate * 100).toFixed(2);
            json["id"] = item.id || Math.ceil(Math.random() * 1000000);
            json["joiners"] = item.extInfo ? item.extInfo.joiners : "";
            json["canApprove"] = item.canApprove;
            json["frontTaskId"] = item.extInfo ? item.extInfo.frontTaskId : ""; //前置任务
            json["hasChildren"] = item.hasChildren;
            json["children"] = []; //item.children
            json["childrens"] = item.children;
            json["canAddChild"] = item.canAddChild;
            json["importantLevel"] = item.extInfo ? item.extInfo.importantLevel : ""; //item.children
            json['duBan'] = item.extInfo ? item.extInfo.duBan : ""
            json['dbTypeName'] = item.extInfo ? item.extInfo.dbTypeName : ""
            json['richContent'] = item.basicInfo.richContent
            json['reportCycle'] = item.extInfo.reportCycle
            json['supervise'] = item.extInfo.supervise
            list.push(json);
          }
          console.log('list',list)
          if (obj && obj.isLoad && typeof obj.resolve === "function") {
            //将list存入深拷贝数组一份
            const rowIndex = this.deepTableData.findIndex((item) => {
              return item.taskId === obj.taskId;
            });
            const deepList = list.map((item) => {
              return {
                taskId: item.taskId,
                superId: item.superId,
                title: item.title,
              };
            });
            this.deepTableData.splice(rowIndex + 1, 0, ...deepList);
            //resolve方法加载的数据不知如何取到
            obj.resolve(list);
          } else {
            this.total = data.data.total;
            this.tableData = list;

            //copy
            this.deepTableData = list.map((item) => {
              return { taskId: item.taskId, title: item.title };
            });
          }
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.table-panel {
  padding: 10px;
  box-sizing: border-box;
}
.table-pagination {
  padding: 8px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  height: 50px;
  background-color: white;
  border-color: #e4e7ed;
  border-style: solid;
  border-width: 0 1px 1px 1px;
}
/deep/ .el-dialog {
  margin-top: 50px !important;
}
/deep/ .el-dialog__body {
  padding-top: 0 !important;
}
</style>
